home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / gpt32src.zip / BITMAP.C < prev    next >
C/C++ Source or Header  |  1992-03-25  |  53KB  |  1,063 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: bitmap.c,v 3.26 92/03/24 22:34:39 woo Exp Locker: woo $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - bitmap.c */
  7. /*
  8.  * Copyright (C) 1986, 1987, 1990, 1991, 1992   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Jyrki Yli-Nokari <jty@intrin.UUCP>
  27.  *     Ronald J. Hartranft <rjh2@ns.cc.lehigh.edu>
  28.  *     Russell Lang <rjl@monu1.cc.monash.edu.au>
  29.  * 
  30.  * Send your comments or suggestions to 
  31.  *  info-gnuplot@ames.arc.nasa.gov.
  32.  * This is a mailing list; to join it send a note to 
  33.  *  info-gnuplot-request@ames.arc.nasa.gov.  
  34.  * Send bug reports to
  35.  *  bug-gnuplot@ames.arc.nasa.gov.
  36.  */
  37.  
  38. /*
  39. ** General raster plotting routines.
  40. ** Raster routines written and copyrighted 1987 by
  41. ** Jyrki Yli-Nokari (jty@intrin.UUCP)
  42. ** Intrinsic, Ltd.
  43. **
  44. ** You may use this code for anything you like as long as
  45. ** you are not selling it and the credit is given and
  46. ** this message retained.
  47. **
  48. */
  49.  
  50. /* Bitmap plotting routines derived from above raster plotting routines
  51.  * Russell Lang, 1990
  52.  */
  53.  
  54. #include <stdio.h>
  55. #include "plot.h"
  56. #include "bitmap.h"
  57.  
  58. bitmap *b_p = (bitmap *)NULL;    /* global pointer to bitmap */
  59. unsigned int b_currx, b_curry;    /* the current coordinates */
  60. unsigned int b_xsize, b_ysize;    /* the size of the bitmap */
  61. unsigned int b_planes;            /* number of color planes */
  62. unsigned int b_psize;            /* size of each plane */
  63. unsigned int b_rastermode;        /* raster mode rotates -90deg */
  64. unsigned int b_linemask = 0xffff;    /* 16 bit mask for dotted lines */
  65. unsigned int b_value = 1;        /* colour of lines */
  66. unsigned int b_hchar;            /* width of characters */
  67. unsigned int b_hbits;            /* actual bits in char horizontally */
  68. unsigned int b_vchar;            /* height of characters */
  69. unsigned int b_vbits;            /* actual bits in char vertically */
  70. unsigned int b_angle;            /* rotation of text */
  71. char_box b_font[FNT_CHARS];        /* the current font */
  72. unsigned int b_pattern[] = {0xffff, 0x1111,
  73.     0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
  74. int b_maskcount = 0;
  75. unsigned int b_lastx, b_lasty;    /* last pixel set - used by b_line */
  76.  
  77. #define IN(i,size)  ((unsigned)i < (unsigned)size)
  78.  
  79. /* 5x9 font, bottom row first, left pixel in lsb */
  80. char_row FAR fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
  81.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000},
  82.   /*!*/  {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
  83.   /*"*/  {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
  84.   /*#*/  {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
  85.   /*$*/  {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
  86.   /*%*/  {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
  87.   /*&*/  {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
  88.   /*'*/  {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
  89.   /*(*/  {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
  90.   /*)*/  {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
  91.   /***/  {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
  92.   /*+*/  {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
  93.   /*,*/  {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
  94.   /*-*/  {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
  95.   /*.*/  {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
  96.   /*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
  97.   /*0*/  {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
  98.   /*1*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
  99.   /*2*/  {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
  100.   /*3*/  {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
  101.   /*4*/  {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
  102.   /*5*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
  103.   /*6*/  {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
  104.   /*7*/  {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  105.   /*8*/  {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
  106.   /*9*/  {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
  107.   /*:*/  {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
  108.   /*;*/  {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
  109.   /*<*/  {000000,000000,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,0x0008},
  110.   /*=*/  {000000,000000,000000,000000,0x001f,000000,0x001f,000000,000000},
  111.   /*>*/  {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
  112.   /*?*/  {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
  113.   /*@*/  {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
  114.   /*A*/  {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
  115.   /*B*/  {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
  116.   /*C*/  {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
  117.   /*D*/  {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
  118.   /*E*/  {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  119.   /*F*/  {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  120.   /*G*/  {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
  121.   /*H*/  {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
  122.   /*I*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
  123.   /*J*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
  124.   /*K*/  {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
  125.   /*L*/  {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  126.   /*M*/  {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
  127.   /*N*/  {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
  128.   /*O*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
  129.   /*P*/  {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
  130.   /*Q*/  {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
  131.   /*R*/  {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
  132.   /*S*/  {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
  133.   /*T*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
  134.   /*U*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
  135.   /*V*/  {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
  136.   /*W*/  {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
  137.   /*X*/  {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
  138.   /*Y*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
  139.   /*Z*/  {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  140.   /*[*/  {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
  141.   /*\*/  {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
  142.   /*]*/  {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
  143.   /*^*/  {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
  144.   /*_*/  {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
  145.   /*`*/  {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
  146.   /*a*/  {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
  147.   /*b*/  {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
  148.   /*c*/  {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
  149.   /*d*/  {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
  150.   /*e*/  {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
  151.   /*f*/  {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
  152.   /*g*/  {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  153.   /*h*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
  154.   /*i*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
  155.   /*j*/  {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
  156.   /*k*/  {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
  157.   /*l*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
  158.   /*m*/  {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
  159.   /*n*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
  160.   /*o*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
  161.   /*p*/  {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
  162.   /*q*/  {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  163.   /*r*/  {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
  164.   /*s*/  {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
  165.   /*t*/  {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
  166.   /*u*/  {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
  167.   /*v*/  {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
  168.   /*w*/  {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
  169.   /*x*/  {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
  170.   /*y*/  {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
  171.   /*z*/  {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
  172.   /*{*/  {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
  173.   /*|*/  {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
  174.   /*}*/  {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
  175.   /*~*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
  176.   /*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
  177. };
  178.  
  179. /* 9x17 font, bottom row first, left pixel in lsb */
  180. char_row FAR fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
  181.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  182.           000000,000000,000000,000000,000000,000000,000000,000000},
  183.   /*!*/  {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
  184.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
  185.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  186.           000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
  187.   /*#*/  {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
  188.           0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
  189.   /*$*/  {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
  190.           0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
  191.   /*%*/  {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
  192.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
  193.   /*&*/  {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
  194.           0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
  195.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  196.           000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
  197.   /*(*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
  198.           0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
  199.   /*)*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
  200.           0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
  201.   /***/  {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
  202.           0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
  203.   /*+*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
  204.           0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
  205.   /*,*/  {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
  206.           000000,000000,000000,000000,000000,000000,000000,000000},
  207.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  208.           000000,0x01ff,000000,000000,000000,000000,000000,000000},
  209.   /*.*/  {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
  210.           000000,000000,000000,000000,000000,000000,000000,000000},
  211.   /*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
  212.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
  213.   /*0*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
  214.           0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
  215.   /*1*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  216.           0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
  217.   /*2*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  218.           0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  219.   /*3*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  220.           0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  221.   /*4*/  {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
  222.           0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
  223.   /*5*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  224.           0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
  225.   /*6*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  226.           0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
  227.   /*7*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
  228.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
  229.   /*8*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  230.           0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
  231.   /*9*/  {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
  232.           0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
  233.   /*:*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
  234.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  235.   /*;*/  {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
  236.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  237.   /*<*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0004,
  238.           0x0002,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040},
  239.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x01ff,
  240.           000000,000000,000000,0x01ff,000000,000000,000000,000000},
  241.   /*>*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
  242.           0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
  243.   /*?*/  {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
  244.           0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  245.   /*@*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
  246.           0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
  247.   /*A*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
  248.           0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
  249.   /*B*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  250.           0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
  251.   /*C*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  252.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
  253.   /*D*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  254.           0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
  255.   /*E*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  256.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  257.   /*F*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  258.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  259.   /*G*/  {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
  260.           0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
  261.   /*H*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  262.           0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  263.   /*I*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  264.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
  265.   /*J*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  266.           0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
  267.   /*K*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  268.           0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
  269.   /*L*/  {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
  270.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  271.   /*M*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  272.           0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
  273.   /*N*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
  274.           0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
  275.   /*O*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  276.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  277.   /*P*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  278.           0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  279.   /*Q*/  {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
  280.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  281.   /*R*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  282.           0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  283.   /*S*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  284.           0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
  285.   /*T*/  {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
  286.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
  287.   /*U*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  288.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  289.   /*V*/  {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
  290.           0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
  291.   /*W*/  {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
  292.           0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  293.   /*X*/  {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
  294.           0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  295.   /*Y*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  296.           0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  297.   /*Z*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
  298.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
  299.   /*[*/  {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
  300.           0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
  301.   /*\*/  {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
  302.           0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
  303.   /*]*/  {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
  304.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
  305.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  306.           000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
  307.   /*_*/  {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
  308.           000000,000000,000000,000000,000000,000000,000000,000000},
  309.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  310.           000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
  311.   /*a*/  {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
  312.           0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
  313.   /*b*/  {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
  314.           0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
  315.   /*c*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  316.           0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  317.   /*d*/  {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
  318.           0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
  319.   /*e*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
  320.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  321.   /*f*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  322.           0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
  323.   /*g*/  {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  324.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  325.   /*h*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  326.           0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
  327.   /*i*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  328.           0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
  329.   /*j*/  {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
  330.           0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
  331.   /*k*/  {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
  332.           0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
  333.   /*l*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  334.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
  335.   /*m*/  {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
  336.           0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
  337.   /*n*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  338.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  339.   /*o*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  340.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  341.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
  342.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  343.   /*q*/  {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  344.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  345.   /*r*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  346.           0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
  347.   /*s*/  {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
  348.           0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
  349.   /*t*/  {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
  350.           0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
  351.   /*u*/  {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
  352.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  353.   /*v*/  {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
  354.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  355.   /*w*/  {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
  356.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  357.   /*x*/  {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
  358.           0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
  359.   /*y*/  {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
  360.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  361.   /*z*/  {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
  362.           0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
  363.   /*{*/  {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
  364.           0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
  365.   /*|*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  366.           000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
  367.   /*}*/  {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
  368.           0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
  369.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  370.           000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
  371.   /*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
  372.           000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
  373. };
  374.  
  375. /* 13x25 font, bottom row first, left pixel in lsb */
  376. char_row FAR fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
  377.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  378.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  379.           000000,000000,000000,000000,000000,000000,000000},
  380.   /*!*/  {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
  381.           000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
  382.           0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
  383.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  384.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  385.           0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  386.   /*#*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
  387.           0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
  388.           0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  389.   /*$*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  390.           0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
  391.           0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
  392.   /*%*/  {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
  393.           0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  394.           0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
  395.   /*&*/  {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
  396.           0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
  397.           0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
  398.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  399.           000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
  400.           0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
  401.   /*(*/  {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
  402.           0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
  403.           0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
  404.   /*)*/  {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
  405.           0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
  406.           0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
  407.   /***/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  408.           0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
  409.           0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
  410.   /*+*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  411.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
  412.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
  413.   /*,*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  414.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  415.           000000,000000,000000,000000,000000,000000,000000},
  416.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  417.           000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  418.           000000,000000,000000,000000,000000,000000,000000},
  419.   /*.*/  {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
  420.           0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
  421.           000000,000000,000000,000000,000000,000000,000000},
  422.   /*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
  423.           0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  424.           0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
  425.   /*0*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  426.           0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
  427.           0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
  428.   /*1*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  429.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  430.           0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
  431.   /*2*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  432.           0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
  433.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  434.   /*3*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  435.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
  436.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  437.   /*4*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
  438.           0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
  439.           0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
  440.   /*5*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  441.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
  442.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  443.   /*6*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  444.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
  445.           0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
  446.   /*7*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  447.           0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  448.           0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
  449.   /*8*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  450.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
  451.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  452.   /*9*/  {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
  453.           0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
  454.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  455.   /*:*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
  456.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  457.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  458.   /*;*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  459.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  460.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  461.   /*<*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0100,0x0080,
  462.           0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,
  463.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200},
  464.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  465.           000000,000000,000000,0x1fff,000000,000000,000000,000000,000000,
  466.           0x1fff,000000,000000,000000,000000,000000,000000},
  467.   /*>*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
  468.           0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
  469.           0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
  470.   /*?*/  {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
  471.           000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  472.           0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
  473.   /*@*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
  474.           0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
  475.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  476.   /*A*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  477.           0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
  478.           0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
  479.   /*B*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  480.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
  481.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  482.   /*C*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  483.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  484.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  485.   /*D*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  486.           0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
  487.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  488.   /*E*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  489.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  490.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  491.   /*F*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  492.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  493.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  494.   /*G*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
  495.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
  496.           0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
  497.   /*H*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  498.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
  499.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  500.   /*I*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  501.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  502.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
  503.   /*J*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  504.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
  505.           0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
  506.   /*K*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  507.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
  508.           0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
  509.   /*L*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
  510.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  511.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  512.   /*M*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  513.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
  514.           0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
  515.   /*N*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  516.           0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
  517.           0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
  518.   /*O*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  519.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  520.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  521.   /*P*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  522.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
  523.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  524.   /*Q*/  {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
  525.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  526.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  527.   /*R*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  528.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
  529.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  530.   /*S*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  531.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
  532.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  533.   /*T*/  {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
  534.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  535.           0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
  536.   /*U*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  537.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  538.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  539.   /*V*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
  540.           0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
  541.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  542.   /*W*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
  543.           0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
  544.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  545.   /*X*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  546.           0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
  547.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
  548.   /*Y*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  549.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
  550.           0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
  551.   /*Z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  552.           0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  553.           0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
  554.   /*[*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
  555.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
  556.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
  557.   /*\*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
  558.           0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
  559.           0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
  560.   /*]*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
  561.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
  562.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
  563.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  564.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  565.           0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
  566.   /*_*/  {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  567.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  568.           000000,000000,000000,000000,000000,000000,000000},
  569.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  570.           000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
  571.           0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
  572.   /*a*/  {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
  573.           0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
  574.           0x03f8,000000,000000,000000,000000,000000,000000},
  575.   /*b*/  {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
  576.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  577.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  578.   /*c*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  579.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
  580.           0x03f8,000000,000000,000000,000000,000000,000000},
  581.   /*d*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  582.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  583.           0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
  584.   /*e*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
  585.           0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
  586.           0x03f8,000000,000000,000000,000000,000000,000000},
  587.   /*f*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  588.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
  589.           0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
  590.   /*g*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
  591.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  592.           0x13f8,000000,000000,000000,000000,000000,000000},
  593.   /*h*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  594.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  595.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  596.   /*i*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  597.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
  598.           000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
  599.   /*j*/  {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
  600.           0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
  601.           000000,000000,000000,0x0700,0x0700,0x0700,000000},
  602.   /*k*/  {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
  603.           0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
  604.           0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
  605.   /*l*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  606.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  607.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
  608.   /*m*/  {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
  609.           0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
  610.           0x0209,000000,000000,000000,000000,000000,000000},
  611.   /*n*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  612.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  613.           0x03f9,000000,000000,000000,000000,000000,000000},
  614.   /*o*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  615.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
  616.           0x03f8,000000,000000,000000,000000,000000,000000},
  617.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
  618.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  619.           0x03f9,000000,000000,000000,000000,000000,000000},
  620.   /*q*/  {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
  621.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  622.           0x13f8,000000,000000,000000,000000,000000,000000},
  623.   /*r*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  624.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
  625.           0x03f9,000000,000000,000000,000000,000000,000000},
  626.   /*s*/  {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
  627.           0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
  628.           0x07f8,000000,000000,000000,000000,000000,000000},
  629.   /*t*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
  630.           0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  631.           0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  632.   /*u*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  633.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  634.           0x1001,000000,000000,000000,000000,000000,000000},
  635.   /*v*/  {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
  636.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
  637.           0x1001,000000,000000,000000,000000,000000,000000},
  638.   /*w*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
  639.           0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  640.           0x1001,000000,000000,000000,000000,000000,000000},
  641.   /*x*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
  642.           0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
  643.           0x1001,000000,000000,000000,000000,000000,000000},
  644.   /*y*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
  645.           0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  646.           0x1001,000000,000000,000000,000000,000000,000000},
  647.   /*z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
  648.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  649.           0x1fff,000000,000000,000000,000000,000000,000000},
  650.   /*{*/  {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
  651.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
  652.           0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
  653.   /*|*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  654.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
  655.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  656.   /*}*/  {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
  657.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
  658.           0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
  659.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  660.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  661.           0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
  662.   /*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
  663.           0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
  664.           0x1249,000000,000000,0x1249,000000,000000,0x1249},
  665. };
  666.  
  667. /*
  668. ** The plotting area is defined as a huge bitmap.
  669. ** The bitmap is stored in a dynamically allocated pixel array b_p
  670. **
  671. ** The bitmap is allocated (and initialized to zero) with
  672. ** b_makebitmap(xsize, ysize, planes)
  673. ** and freed with b_freebitmap()
  674. ** xsize and ysize will be rounded up to a multiple of 8.
  675. **
  676. ** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
  677. **
  678. ** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
  679. ** where the point (x,y) is the target to go from the current point
  680. ** To set the color use b_setvalue(value) where value is the value 
  681. ** (0 or 1 or a color number) to be stored in every pixel.
  682. ** To get dotted line styles, use b_setlinetype(linetype).
  683. **
  684. ** Internally all plotting goes through b_setpixel(x, y, value).
  685. */
  686.  
  687.  
  688. /*
  689. ** set pixel (x, y, value) to value value (this can be 1/0 or a color number).
  690. */
  691. void
  692. b_setpixel(x, y, value)
  693. unsigned int x, y, value;
  694. {
  695.   register unsigned int row;
  696.   register unsigned char mask;
  697.   int i;
  698.   if (b_rastermode) {
  699.     /* interchange so that new (x,y) is old (y,b_ysize-1-x) */
  700.     row = x;  /* temp storage */
  701.     x = y;
  702.     y = b_ysize-1-row;
  703.   }
  704.   if (IN(x, b_xsize) && IN(y, b_ysize))
  705.   {
  706.     row = y/8;
  707.     mask = 1<<(y%8);
  708.  
  709.     for (i=0; i<b_planes; i++) {
  710.         if (value&1)
  711.             *((*b_p)[row]+x) |= mask;
  712.         else
  713.             *((*b_p)[row]+x) &= ~mask;
  714.         row += b_psize;
  715.         value >>= 1;
  716.     }
  717.   }
  718. #ifdef BITMAPDEBUG
  719.   else
  720.   {
  721.     if (b_rastermode)
  722.       fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n", 
  723.         b_ysize-1-y, x, value);
  724.     else
  725.       fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
  726.         x, y, value);
  727.   }
  728. #endif
  729. }
  730.  
  731. /*
  732. ** get pixel (x,y) value----unused
  733. */
  734. /****************************
  735. unsigned int
  736. b_getpixel(x, y)
  737. unsigned int x, y;
  738. {
  739.   register unsigned int row;
  740.   register unsigned char mask;
  741.   register unsigned char value;
  742.   int i;
  743.  
  744.   if (b_rastermode) {
  745.     row = x;
  746.     x = y;
  747.     y = b_ysize-1-row;
  748.   }
  749.   if (IN(x, b_xsize) && IN(y, b_ysize))
  750.   {
  751.     row = y/8 + (b_planes-1)*b_psize;
  752.     mask = 1<<(y%8);
  753.  
  754.     for (i=0; i<b_planes; i++) {
  755.         if ( *((*b_p)[row]+x) & mask )
  756.             value |= 1;
  757.         row -= b_psize;
  758.         value <<= 1;
  759.     }
  760.     return(value);
  761.   }
  762.   else
  763.   {
  764. #ifdef BITMAPDEBUG
  765.     if (b_rastermode)
  766.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
  767.         b_ysize-1-y, x);
  768.     else
  769.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
  770. #endif
  771.     return(0);
  772.   }
  773. }
  774. ********************************/
  775.  
  776. /*
  777. ** allocate the bitmap
  778. */
  779. void
  780. b_makebitmap(x, y, planes)
  781. unsigned int x, y, planes;
  782. {
  783.   register unsigned j;
  784.   unsigned rows;
  785.  
  786.   x = 8 * (unsigned int)(x/8.0+0.9);    /* round up to multiple of 8 */
  787.   y = 8 * (unsigned int)(y/8.0+0.9);    /* round up to multiple of 8 */
  788.   b_psize = y/8;                    /* size of each plane */
  789.   rows = b_psize * planes;            /* total number of rows of 8 pixels high */
  790.   b_xsize = x; b_ysize = y;
  791.   b_currx = b_curry = 0;
  792.   b_planes = planes;
  793.   b_value = 1;
  794.   b_angle = 0;
  795.   b_rastermode = 0;
  796.   /* allocate row pointers */
  797.   b_p = (bitmap *)alloc( rows * sizeof(pixels *), "bitmap row buffer");
  798.   bzero(b_p, rows * sizeof(pixels *));
  799.   for (j = 0; j < rows; j++) {
  800.     /* allocate bitmap buffers */
  801.     (*b_p)[j] = (pixels *)alloc(x * sizeof(pixels),(char *)NULL);
  802.     if ((*b_p)[j] == (pixels *)NULL) {
  803.         b_freebitmap();  /* free what we have already allocated */
  804.         int_error("out of memory for bitmap buffer", NO_CARET);
  805.     }
  806.     bzero((*b_p)[j], x * sizeof(pixels));
  807.   }
  808. }
  809.   
  810. /*
  811. ** free the allocated bitmap
  812. */
  813. void
  814. b_freebitmap()
  815. {
  816.   int j;
  817.   unsigned rows;
  818.  
  819.   rows = b_psize * b_planes;   /* total number of rows of 8 pixels high */
  820.   for (j = 0; j < rows; j++)
  821.   {
  822.     (void) free((char *)(*b_p)[j]);
  823.   }
  824.   (void) free((char *)b_p);
  825.   b_p = (bitmap *)(NULL);
  826. }
  827.  
  828. /*
  829. ** set pixel at (x,y) with color b_value and dotted mask b_linemask.
  830. */
  831. void
  832. b_setmaskpixel(x,y,value)
  833. unsigned int x,y,value;
  834. {
  835.     /* dotted line generator */
  836.     if ((b_linemask>>b_maskcount)&(unsigned int)(1)) {
  837.         b_setpixel(x,y,value);
  838.     }
  839.     b_maskcount= (b_maskcount+1) % 16;
  840.     b_lastx= x;  /* last pixel set with mask */
  841.     b_lasty= y;
  842. }
  843.  
  844. /*
  845. ** draw a line from (x1,y1) to (x2,y2)
  846. ** with color b_value and dotted mask b_linemask.
  847. */
  848. void
  849. b_line(x1,y1,x2,y2)
  850. unsigned int x1,y1,x2,y2;
  851. {
  852. int runcount;
  853. int dx,dy;
  854. int xinc,yinc;
  855. unsigned int xplot,yplot;
  856.  
  857.     runcount=0;
  858.     dx = abs((int)(x1)-(int)(x2));
  859.     if (x2>x1)  xinc=  1;
  860.     if (x2==x1) xinc=  0;
  861.     if (x2<x1)  xinc= -1;
  862.     dy = abs((int)(y1)-(int)(y2));
  863.     if (y2>y1)  yinc=  1;
  864.     if (y2==y1) yinc=  0;
  865.     if (y2<y1)  yinc= -1;
  866.     xplot=x1;
  867.     yplot=y1;
  868.     if (dx>dy) {
  869.         /* iterate x */
  870.         if ( (b_linemask==0xffff) ||
  871.             ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  872.             b_setmaskpixel(xplot,yplot,b_value);
  873.         while (xplot!=x2) {
  874.             xplot+=xinc;
  875.             runcount+=dy;
  876.             if (runcount>=(dx-runcount)) {
  877.                 yplot+=yinc;
  878.                 runcount-=dx;
  879.             }
  880.             b_setmaskpixel(xplot,yplot,b_value);
  881.         }
  882.     } else {
  883.         /* iterate y */
  884.         if ( (b_linemask==0xffff) ||
  885.             ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  886.             b_setmaskpixel(xplot,yplot,b_value);
  887.         while (yplot!=y2) {
  888.             yplot+=yinc;
  889.             runcount+=dx;
  890.             if (runcount>=(dy-runcount)) {
  891.                 xplot+=xinc;
  892.                 runcount-=dy;
  893.             }
  894.             b_setmaskpixel(xplot,yplot,b_value);
  895.         }
  896.     }
  897. }
  898.  
  899. /*
  900. ** set character size
  901. */
  902. void
  903. b_charsize(size)
  904. unsigned int size;
  905. {
  906.     int j;
  907.     switch(size) {
  908.         case FNT5X9:
  909.             b_hchar = FNT5X9_HCHAR;
  910.             b_hbits = FNT5X9_HBITS;
  911.             b_vchar = FNT5X9_VCHAR;
  912.             b_vbits = FNT5X9_VBITS;
  913.             for (j = 0; j < FNT_CHARS; j++ )
  914.                 b_font[j] = &fnt5x9[j][0];
  915.             break;
  916.         case FNT9X17:
  917.             b_hchar = FNT9X17_HCHAR;
  918.             b_hbits = FNT9X17_HBITS;
  919.             b_vchar = FNT9X17_VCHAR;
  920.             b_vbits = FNT9X17_VBITS;
  921.             for (j = 0; j < FNT_CHARS; j++ )
  922.                 b_font[j] = &fnt9x17[j][0];
  923.             break;
  924.         case FNT13X25:
  925.             b_hchar = FNT13X25_HCHAR;
  926.             b_hbits = FNT13X25_HBITS;
  927.             b_vchar = FNT13X25_VCHAR;
  928.             b_vbits = FNT13X25_VBITS;
  929.             for (j = 0; j < FNT_CHARS; j++ )
  930.                 b_font[j] = &fnt13x25[j][0];
  931.             break;
  932.         default:
  933.             int_error("Unknown character size",NO_CARET);
  934.     }
  935. }
  936.  
  937.  
  938. /*
  939. ** put characater c at (x,y) rotated by angle with color b_value.
  940. */
  941. void
  942. b_putc(x,y,c,angle)
  943. unsigned int x,y;
  944. char c;
  945. unsigned int angle;
  946. {
  947.     unsigned int i, j, k;
  948.     char_row fc;
  949.  
  950.     j = c - ' ';
  951.     for ( i = 0; i < b_vbits; i++ ) {
  952.         fc = *( b_font[j] + i );
  953.         if ( c == '_' ) {    /* treat underline specially */
  954.             if ( fc  ) {    /* this this the underline row ? *?
  955.                 /* draw the under line for the full h_char width */
  956.                 for ( k = ( b_hbits - b_hchar )/2;
  957.                     k < ( b_hbits + b_hchar )/2; k++ ) {
  958.                     switch(angle) {
  959.                         case 0 : b_setpixel(x+k+1,y+i,b_value);
  960.                             break;
  961.                         case 1 : b_setpixel(x-i,y+k+1,b_value);
  962.                             break;
  963.                     }
  964.                 }
  965.             }
  966.         }
  967.         else {
  968.             /* draw character */
  969.             for ( k = 0; k < b_hbits; k++ ) {
  970.                 if ( ( fc >> k ) & 1 ) {
  971.                     switch(angle) {
  972.                         case 0 : b_setpixel(x+k+1,y+i,b_value);
  973.                             break;
  974.                         case 1 : b_setpixel(x-i,y+k+1,b_value);
  975.                             break;
  976.                     }
  977.                 }
  978.             }
  979.         }
  980.     }
  981. }
  982.  
  983.  
  984. /*
  985. ** set b_linemask to b_pattern[linetype]
  986. */
  987. int
  988. b_setlinetype(linetype)
  989. int linetype;
  990. {
  991.     if (linetype>=7)
  992.         linetype %= 7;
  993.     b_linemask = b_pattern[linetype+2];
  994.     b_maskcount=0;
  995. }
  996.  
  997. /*
  998. ** set b_value to value
  999. */
  1000. void
  1001. b_setvalue(value)
  1002. unsigned int value;
  1003. {
  1004.     b_value = value;
  1005. }
  1006.  
  1007. /*
  1008. ** move to (x,y)
  1009. */
  1010. int
  1011. b_move(x, y)
  1012. unsigned int x, y;
  1013. {
  1014.   b_currx = x;
  1015.   b_curry = y;
  1016. }
  1017.  
  1018. /*
  1019. ** draw to (x,y) with color b_value
  1020. */
  1021. int
  1022. b_vector(x, y)
  1023. unsigned int x, y;
  1024. {
  1025.   b_line(b_currx, b_curry, x, y);
  1026.   b_currx = x;
  1027.   b_curry = y;
  1028. }
  1029.  
  1030.  
  1031. /*
  1032. ** put text str at (x,y) with color b_value and rotation b_angle
  1033. */
  1034. int
  1035. b_put_text(x,y,str)
  1036. unsigned int x, y;
  1037. char *str;
  1038. {
  1039.     if (b_angle == 1)
  1040.         x += b_vchar/2;
  1041.     else
  1042.         y -= b_vchar/2;
  1043.    switch (b_angle) {
  1044.       case 0:
  1045.      for (; *str; ++str, x += b_hchar)
  1046.         b_putc (x, y, *str, b_angle);
  1047.                     break;
  1048.       case 1:
  1049.      for (; *str; ++str, y += b_hchar)
  1050.         b_putc (x, y, *str, b_angle);
  1051.                     break;
  1052.     }
  1053. }
  1054.  
  1055.  
  1056. int
  1057. b_text_angle(ang)
  1058. int ang;
  1059. {
  1060.     b_angle=(unsigned int)ang;
  1061.     return TRUE;
  1062. }
  1063.